import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [

  { path: '/login', name: '登录', component: _import('login/index'), hidden: true },
  { path: '/404', name: '404', component: _import('404'), hidden: true },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    hidden: true,
    children: [
      { path: 'dashboard', component: _import('dashboard/index'), name: '首页', meta: { title: '首页', icon: 'dashboard', noCache: true }}
      // { path: 'upload', component: _import('admin/user/info'), name: '修改信息', meta: { title: '修改信息', icon: '', noCache: true } }
    ]
  }
]

export default new Router({
  // mode: 'history', // 后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

export const asyncRouterMap = [

  {
    menuId: 251,
    path: '/airport/admin',
    component: Layout,
    name: '用户管理',
    hidden: false,
    redirect: '/airport/admin/user',
    // icon: 'table',
    meta: {
      title: '用户管理',
      icon: 'peoples'
    },
    children: [
      { menuId: 252, path: 'user', component: _import('admin/user/index'), name: '用户管理', meta: { title: '用户管理', icon: 'user' }}
    ]
  },
  {
    menuId: 256,
    path: '/airport/region',
    component: Layout,
    name: '区域管理',
    hidden: false,
    redirect: '/airport/region/region',
    // icon: 'table',
    meta: {
      title: '区域管理',
      icon: 'tree'
    },
    children: [
      { menuId: 257, path: 'region', component: _import('region/region/index'), name: '区域信息', meta: { title: '区域信息', icon: 'role' }}
    ]
  },
  {
    menuId: 263,
    path: '/airport/facilityType',
    component: Layout,
    name: '标识分类管理',
    hidden: false,
    redirect: '/airport/facilityType/vendor',
    // icon: 'table',
    meta: {
      title: '标识分类管理',
      icon: 'chart'
    },
    children: [
      { menuId: 264, path: 'vendor', component: _import('facilityType/vendor/index'), name: '厂商信息', meta: { title: '厂商信息', icon: 'cache' }},
      { menuId: 265, path: 'category', component: _import('facilityType/category/index'), name: '类别信息', meta: { title: '类别信息', icon: 'dept' }},
      { menuId: 266, path: 'material', component: _import('facilityType/material/index'), name: '材质信息', meta: { title: '材质信息', icon: 'clipboard' }},
      { menuId: 267, path: 'specification', component: _import('facilityType/specification/index'), name: '规格信息', meta: { title: '规格信息', icon: 'code' }}
    ]
  },
  {
    menuId: 280,
    path: '/airport/facility',
    component: Layout,
    name: '标识管理',
    hidden: false,
    redirect: '/airport/facility/light',
    // icon: 'table',
    meta: {
      title: '标识管理',
      icon: 'component'
    },
    children: [
      { menuId: 281, path: 'light', component: _import('facility/light/index'), name: '有源标识', meta: { title: '有源标识', icon: 'monitor' }},
      { menuId: 285, path: 'nolight', component: _import('facility/nolight/index'), name: '无源标识', meta: { title: '无源标识', icon: 'dashboard' }}
    ]
  },
  {
    menuId: 289,
    path: '/airport/patrol',
    component: Layout,
    name: '巡视记录管理',
    hidden: false,
    redirect: '/airport/patrol/patrol',
    // icon: 'table',
    meta: {
      title: '巡视记录管理',
      icon: 'eye'
    },
    children: [
      { menuId: 290, path: 'patrol', component: _import('patrol/patrol/index'), name: '巡视记录', meta: { title: '巡视记录', icon: 'drag' }}
    ]
  },
  {
    menuId: 291,
    path: '/airport/maintenance',
    component: Layout,
    name: '维修记录管理',
    hidden: false,
    redirect: '/airport/maintenance/maintenance',
    // icon: 'table',
    meta: {
      title: '维修记录管理',
      icon: 'form'
    },
    children: [
      { menuId: 292, path: 'maintenance', component: _import('maintenance/maintenance/index'), name: '维修记录', meta: { title: '维修记录', icon: 'example' }}
    ]
  },
  {
    menuId: 302,
    path: '/airport/message',
    component: Layout,
    name: '消息服务管理',
    hidden: false,
    redirect: '/airport/message/message',
    // icon: 'table',
    meta: {
      title: '消息服务管理',
      icon: 'message'
    },
    children: [
      { menuId: 303, path: 'message', component: _import('message/message/index'), name: '消息服务配置', meta: { title: '消息服务配置', icon: 'message' }}
    ]
  },
  {
    menuId: 293,
    path: '/airport/email',
    component: Layout,
    name: '邮件服务管理',
    hidden: false,
    redirect: '/airport/email/email',
    // icon: 'table',
    meta: {
      title: '邮件服务管理',
      icon: 'email'
    },
    children: [
      { menuId: 294, path: 'email', component: _import('email/email/index'), name: '邮件服务配置', meta: { title: '邮件服务配置', icon: 'email' }},
      { menuId: 298, path: 'task', component: _import('task/task/index'), name: '定时服务配置', meta: { title: '定时服务配置', icon: 'log' }}
    ]
  }

]
